#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM registry.cn-shanghai.aliyuncs.com/yangww/dotnetruntime:v1.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM registry.cn-shanghai.aliyuncs.com/yangww/dotnetsdk:v1.0 AS build
WORKDIR /src
COPY ["src/Gateway/OcelotConsulDemo.Gateway/OcelotConsulDemo.Gateway.csproj", "src/Gateway/OcelotConsulDemo.Gateway/"]

COPY ["./Common/OcelotConsulDemo.Infrastructure","src/Common/OcelotConsulDemo.Infrastructure"]

RUN dotnet restore "src/Gateway/OcelotConsulDemo.Gateway/OcelotConsulDemo.Gateway.csproj"
COPY . .
WORKDIR "/src/src/Gateway/OcelotConsulDemo.Gateway"
RUN dotnet build "OcelotConsulDemo.Gateway.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "OcelotConsulDemo.Gateway.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "OcelotConsulDemo.Gateway.dll"]